package com.michael.demos.springboot.valid.model;

import com.michael.demos.springboot.valid.groups.F1;
import com.michael.demos.springboot.valid.groups.F2;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 类功能描述:
 * <pre>
 *   实体 - 果篮
 * </pre>
 *
 * @author Michael
 * @version 1.0
 * @date 2020/7/29 10:30
 */
@Data
public class FruitBasket implements Serializable {

    private static final long serialVersionUID = 1L;

    /** 果篮颜色 */
    @NotBlank(message = "需要果篮颜色")
    private String color;

    /** 果篮形状 */
    @NotBlank(message = "需要果篮形状", groups = {F1.class})
    private String shape;

    /** 果篮中水果总数 */
    @NotNull(message = "需要果篮中水果总数", groups = {F1.class})
    private Integer fruitCounts;

    /** 果篮的装饰 */
    @Valid
    @NotNull(message = "decoration 不能为空", groups = {F1.class})
    private Decoration decoration;

    /** 果篮中的水果集合 */
    @Valid
    @NotNull(message = "fruitList 不能为空", groups = {F2.class})
    private List<Fruit> fruitList;
}
